home *** CD-ROM | disk | FTP | other *** search
/ Explore Yellowstone / Explore Yellowstone (1997)(The Learning Company)[PC-Mac].iso / mac / ACTXCLUD.DIR / 00001_Script_Main Movie next >
Text File  |  1996-02-28  |  15KB  |  500 lines

  1. --> Main Movie Script
  2. -- for ACTXCLUD.DIR
  3. ----------------------
  4.  
  5. on StartMovie
  6.   
  7.   global PathSepChar, HowManyActivities, ThisRegion, RangerSprite
  8.   global glActivityData, guideFlag, glAnsweredList
  9.   
  10.   set the ItemDelimiter = "/"
  11.   set RangerSprite = 23
  12.   
  13.   if the machineType = 256 then
  14.     set PathSepChar = "\"
  15.   else
  16.     set PathSepChar = ":"
  17.   end if
  18.   
  19.   if VoidP(ThisRegion) then
  20.     set ThisRegion = 1
  21.   end if
  22.   
  23.   
  24.   -- Performed when starting the Activity 
  25.   -- Not performed if querrying the Guidebook
  26.   if guideFlag = False then
  27.     
  28.     parseRegionActivityLine()
  29.     
  30.     LoadExcludeList
  31.     
  32.     -- get current value for HowManyActivities answered correctly
  33.     set HowManyActivities = 0
  34.     set glAnsweredList = []
  35.     set glAnsweredList = getAt(glActivityData, 2)
  36.     put count(glAnsweredList) into itemCount
  37.     put "itemCount:" itemCount
  38.     put min(glAnsweredList) into lowest
  39.     set correctAnswer = lowest + 1
  40.     repeat with x = 1 to itemCount
  41.       put getAt(glAnsweredList, x) into AnsweredActivity
  42.       if AnsweredActivity = correctAnswer then
  43.         set HowManyActivities = HowManyActivities + 1
  44.       end if        
  45.     end repeat
  46.     -- adjust HowManyActivities for another series
  47.     if HowManyActivities > 5 then 
  48.       set HowManyActivities = 0
  49.     else if HowManyActivities > 2 then 
  50.       set HowManyActivities = HowManyActivities - 3
  51.     end if
  52.   end if
  53. end
  54.  
  55. ----------------------
  56.  
  57. on StopMovie
  58.   global RangerSprite
  59.   
  60.   repeat with x = 1 to 24
  61.     puppetSprite x, false
  62.   end repeat
  63.   
  64.     repeat with x = 18 to 21
  65.       set the CastNum of sprite x to the number of cast "PixelCorners"
  66.     end repeat
  67.   
  68.   set the CastNum of sprite RangerSprite to the number of cast "PixelCorners"
  69.   --updateStage
  70.   
  71.   set the ItemDelimiter = ","
  72.   put " " into field "Clue"
  73.   
  74. end
  75.  
  76. ----------------------
  77.  
  78. on parseRegionActivityLine
  79.   
  80.   global ThisRegion, giWhichActivity, glActivityData, glRegionStructure, gsRegionLine
  81.   
  82.   -- get gsRegionLine and glRegionStructure from field "UserList" (taken from YELLOW.PRF)
  83.   -- Get current value for giWhichActivity from gsRegionLine. 
  84.   -- Use giWhichActivity to get glActivityData from glRegionStructure.
  85.   -- glRegionStructure holds all 9 of the Activities' answers for thisRegion.
  86.   
  87.   put the ItemDelimiter into saveDlim
  88.   set the ItemDelimiter = ","
  89.   set gsRegionLine = 0
  90.   set regionLine = 0
  91.   put line (ThisRegion + 38) of field "UserList" into regionLine
  92.   put regionLine                                                  -- for now
  93.   put item 1 to 2 of regionLine into gsRegionLine
  94.   put "gsRegionLine:" gsRegionLine                                  -- for now
  95.   put EMPTY into item 1 to 2 of regionLine
  96.   put EMPTY into char 1 of regionLine
  97.   set glRegionStructure = []
  98.   set glRegionStructure = value(regionLine) 
  99.   put value(item 2 of gsRegionLine) into giWhichActivity           -- for now (duplication)
  100.   set glActivityData = getAt(glRegionStructure, giWhichActivity)
  101.   put "glActivityData:" glActivityData
  102.   set the ItemDelimiter = saveDlim
  103.   
  104. end
  105.  
  106. ----------------------
  107.  
  108. on SwitchRanger WhichRanger
  109.   put
  110.   put "entered SwitchRanger"
  111.   
  112.   global ThisRegion, PathSepChar, RangerSprite
  113.   
  114.   put  WhichRanger & ".PIC" into WhichRanger
  115.   put the PathName & "FIELD" & PathSepChar & WhichRanger into WhichRanger
  116.   set the FileName of cast "Ranger01" to WhichRanger
  117.   puppetSprite RangerSprite, true
  118.   set the CastNum of sprite RangerSprite to the number of cast "Ranger01"
  119.   updateStage
  120.   
  121. end
  122.  
  123. ----------------------
  124.  
  125. on GetQuestion
  126.   put
  127.   put "entered GetQuestion"
  128.   
  129.   global glActivityData, glAnsweredList
  130.   
  131.   put the ItemDelimiter into saveDlim
  132.   set the ItemDelimiter = ","
  133.   set maxQuestion = 6
  134.   
  135.   -- set glActivityData = value(field "currentRegionActivityScores")
  136.   put "glActivityData:" & glActivityData
  137.   
  138.   -- [questionNumber, [#correctQ1, #correctQ2, ... , #correctQ6]]
  139.   -- glAnsweredList = getAt (glActivityData, 2) already set in startMovie
  140.   -- section dealing w/ HowManyActivities
  141.   set questionNumber = getAt (glActivityData, 1)
  142.   set lowest = min(glAnsweredList)
  143.   
  144.   repeat with i = 1 to maxQuestion
  145.     set questionNumber = questionNumber + 1
  146.     if questionNumber > maxQuestion then set questionNumber = 1
  147.     set Q = getAt(glAnsweredList, questionNumber)
  148.     if Q = lowest then exit repeat
  149.   end repeat
  150.   put "questionNumber" questionNumber
  151.   set the ItemDelimiter = saveDlim
  152.   
  153.   return questionNumber
  154.   
  155. end
  156.  
  157. ----------------------
  158.  
  159. on InitQuestion questionNumber
  160.   put
  161.   put "entered InitQuestion"
  162.   
  163.   global WrongAnswer, WhichQuestion, PathSepChar
  164.   global ClueNum, RightNum, ThisRegion
  165.   
  166.   if questionNumber then 
  167.     set WhichQuestion = questionNumber
  168.   else
  169.     set WhichQuestion = 1
  170.   end if
  171.   put "WhichQuestion " & WhichQuestion
  172.   
  173.   put "110010" & ThisRegion into WhichRanger
  174.   SwitchRanger WhichRanger
  175.   
  176.   put EMPTY into field "Files"
  177.   
  178.   repeat with x = 1 to 4    
  179.     put item x of line WhichQuestion of field "ExcludeList" into line x of field "Files"
  180.   end repeat
  181.   
  182.   --> Randomize right answer  
  183.   put random(4) into WrongAnswer  
  184.   put line WrongAnswer of field "Files" into line 1 of field "Files"
  185.   put item 1 of line WhichQuestion of field "ExcludeList" into line WrongAnswer of field "Files"  
  186.   put "WrongAnswer " & WrongAnswer  
  187.   
  188.   repeat with x = 1 to 4    
  189.     put item 1 of line x of field "Files" & ".PIC" into File
  190.     put the PathName & "PICS" & PathSepChar & File into File
  191.     put "File " & File
  192.     put "Pic" & x into WhichCast
  193.     set the FileName of cast WhichCast = File
  194.     puppetSprite x, TRUE
  195.     set the CastNum of sprite x to the number of cast WhichCast
  196.   end repeat
  197.   
  198.   repeat with x = 8 to 11
  199.     puppetSprite x, TRUE
  200.     set the CastNum of sprite x to the number of cast "Eliminate"
  201.     -- initialize shared cast "save1" through "save4"
  202.     put "pixelCorners" into field "save" & (x - 7)
  203.   end repeat
  204.   
  205.   updateStage
  206.   
  207.   put item 5 of line WhichQuestion of field "ExcludeList" into field "Clue"
  208.   set ClueNum = 1
  209.   set RightNum = 0
  210.   
  211. end
  212.  
  213. ----------------------
  214.  
  215. on saveQuestion
  216.   -- save users current place in shared cast when going to guidebook
  217.   -- with currently questions intact upon return
  218.   
  219.   put line 1 of field "files" into field "savedAnswer1"
  220.   put line 2 of field "files" into field "savedAnswer2"
  221.   put line 3 of field "files" into field "savedAnswer3"
  222.   put line 4 of field "files" into field "savedAnswer4"
  223.   put field "Clue" into field "savedItem"  
  224.   
  225.   -- save any current BigX's in shared cast
  226.   repeat with x = 1 to 4
  227.     if the castNum of sprite (x + 17) = the number of cast "bigX" then
  228.       put the name of cast "bigX" into field "save" & x
  229.     else
  230.       put the name of cast "pixelCorners" into field "save" & x
  231.     end if
  232.   end repeat
  233.   
  234.   put field "excludeList" into field "save5"
  235.   
  236. end
  237.  
  238. --------------------
  239.  
  240. on saveActivity
  241.   -- save users current activity when going to guidebook or closing
  242.   -- including already answered scores this activity
  243.   
  244.   global giWhichActivity, glRegionStructure, glActivityData, gsRegionLine, thisRegion
  245.   
  246.   -- glAnsweredList - previous score has been stored already
  247.   -- glActivityData - WhichQuestion and glAnsweredList have been stored already
  248.   
  249.   put the ItemDelimiter into saveDlim
  250.   set the ItemDelimiter = ","
  251.   -- need to rebuild glRegionStructure
  252.   setAt(glRegionStructure, giWhichActivity, glActivityData)
  253.   -- hang on to current giWhichActivity (do not increment), but
  254.   -- rejoin glRegionStructure to a clone of gsRegionLine 
  255.   -- in order to retain global version for possible use later
  256.   put gsRegionLine into regionLine
  257.   put ("," & glRegionStructure) after regionLine
  258.   set the ItemDelimiter = saveDlim
  259.   -- store regionLine in SHARED.DIR field "UserList"
  260.   put regionLine into line (ThisRegion + 38) of field "UserList"
  261.   
  262. end
  263.  
  264. --------------------
  265.  
  266. on initSavedQuestion
  267.   put 
  268.   put "entered initSavedQuestion"
  269.   -- upon return from guidebook get last set of PICS and saved Clue
  270.   -- WrongAnswer, clueNum, and rightNum should be still intact
  271.   global guideFlag, pathSepChar, ThisRegion
  272.   
  273.   set guideFlag = FALSE                   --***
  274.   
  275.   put "110010" & ThisRegion into WhichRanger
  276.   SwitchRanger WhichRanger
  277.   
  278.   repeat with x = 1 to 4
  279.     put field ("savedAnswer" & x) into file
  280.     put the pathName & "PICS" & pathSepChar & file & ".PIC" into file
  281.     put "PIC" & x into whichCast
  282.     set the fileName of cast whichCast = file
  283.     puppetSprite x, TRUE
  284.     set the castNum of sprite x to the number of cast whichCast
  285.   end repeat
  286.   
  287.   repeat with x = 8 to 11
  288.     puppetSprite x, TRUE
  289.     --    set the castNum of sprite x to the number of cast "Eliminate"
  290.   end repeat
  291.   
  292.   -- *** temp - attempt to debug guidebook icon turning into white box
  293.   set the castNum of sprite 8 to the number of cast "Eliminate"
  294.   set the castNum of sprite 9 to the number of cast "Eliminate"
  295.   set the castNum of sprite 10 to the number of cast "Eliminate"
  296.   set the castNum of sprite 11 to the number of cast "Eliminate"
  297.   
  298.   -- restore any current BigX's from shared cast
  299.   repeat with x = 1 to 4
  300.     put field ("save" & x) into buttonState
  301.     puppetSprite (x + 17), TRUE
  302.     set the castNum of sprite (x + 17) = the number of cast buttonState
  303.   end repeat
  304.   
  305.   updateStage                                  --***?
  306.   
  307.   put field "savedItem" into field "Clue" 
  308.   
  309.   put field "save5" into field "excludeList"
  310.   
  311. end
  312.  
  313. ----------------------
  314.  
  315. on DoRightAnswer
  316.   put
  317.   put "entered DoRightAnswer"
  318.   
  319.   global WhichChannel, RightNum, WhichQuestion
  320.   global PathSepChar, ThisRegion, HowManyActivities
  321.   global glAnsweredList, glActivityData, glRegionStructure, giWhichActivity, gsRegionLine
  322.   
  323.   repeat with x = 8 to 11
  324.     if WhichChannel = x then
  325.       set WhichSprite = WhichChannel + 10
  326.       puppetSprite WhichSprite, true
  327.       set the castNum of sprite WhichSprite to the Number of cast "BIGX"            
  328.       updateStage
  329.       exit repeat
  330.     end if
  331.   end repeat  
  332.   
  333.   set RightNum = RightNum + 1
  334.   
  335.   if RightNum > 2 then
  336.     put the itemDelimiter into saveDelim
  337.     set the itemDelimiter = ","
  338.     
  339.     -- increment score in glAnsweredList
  340.     set iCurrentScore = 0
  341.     put getAt(glAnsweredList, WhichQuestion) into iCurrentScore
  342.     set iCurrentScore = iCurrentScore + 1
  343.     setAt(glAnsweredList, WhichQuestion, iCurrentScore)
  344.     
  345.     -- save current question number and answers. Increment HowManyActivities
  346.     setAt(glActivityData, 1, WhichQuestion)
  347.     setAt(glActivityData, 2, glAnsweredList)
  348.     set HowManyActivities = HowManyActivities + 1
  349.     put "HowManyActivities " & HowManyActivities
  350.     
  351.     if HowManyActivities > 2 then
  352.       --> Finished activity. No badge.
  353.       
  354.       -- rebuild glRegionStructure
  355.       setAt(glRegionStructure, giWhichActivity, glActivityData)
  356.       
  357.       -- increment giWhichActivity in gsRegionLine
  358.       set giWhichActivity = giWhichActivity + 1
  359.       put "giWhichActivity:" & giWhichActivity
  360.       put giWhichActivity into item 2 of gsRegionLine
  361.       put "gsRegionLine:" gsRegionLine
  362.       
  363.       -- rejoin glRegionStructure to gsRegionLine
  364.       put ("," & glRegionStructure) after gsRegionLine
  365.       put "gsRegionLine:" gsRegionLine
  366.       
  367.       set the itemDelimiter = saveDelim
  368.       
  369.       -- upload to field "UserList"
  370.       put gsRegionLine into line (ThisRegion + 38) of field "UserList"
  371.       
  372.       -- do positive responses
  373.       put "110020" & ThisRegion into WhichRanger
  374.       SwitchRanger WhichRanger
  375.       
  376.       repeat with x = 18 to 21
  377.         puppetSprite x, false
  378.       end repeat
  379.       
  380.       put GetRightAnswer() into RangerSez
  381.       sound PlayFile 1, RangerSez
  382.       go to "NextActivity"
  383.     else
  384.       --> Not finished, yet
  385.       
  386.       -- save current question number
  387.       setAt(glActivityData, 1, WhichQuestion)
  388.       set the itemDelimiter = saveDelim
  389.       
  390.       -- do positive responses
  391.       put "110020" & ThisRegion into WhichRanger
  392.       SwitchRanger WhichRanger
  393.       
  394.       --***BIG added this segment to remove BIG X's on Skip Question***
  395.       repeat with x = 18 to 21
  396.         puppetSprite x, false
  397.       end repeat
  398.       
  399.       put GetRightAnswer() into RangerSez
  400.       sound PlayFile 1, RangerSez
  401.       go to "GetActivity"
  402.     end if
  403.   end if 
  404. end
  405.  
  406. ----------------------
  407.  
  408. on GetRightAnswer
  409.   put
  410.   put "entered GetRightAnswer"
  411.   
  412.   global PathSepChar, ThisRegion
  413.   
  414.   put random(9) into WhichAnwer
  415.   
  416.   put item 2 of line WhichAnwer of field "PositiveResponse" into RangerSez
  417.   put the PathName & "AUDIO" & PathSepChar & "REGION" & ThisRegion & ┬
  418.    PathSepChar & RangerSez into RangerSez
  419.   
  420.   return RangerSez
  421.   
  422. end
  423.  
  424. ----------------------
  425.  
  426. on DoWrongAnswer
  427.   put
  428.   put "entered DoWrongAnswer"
  429.   
  430.   global WhichQuestion, PathSepChar, ThisRegion, glActivityData
  431.   
  432.   -- save current question number
  433.   put the itemDelimiter into saveDelim
  434.   set the itemDelimiter = ","
  435.   setAt(glActivityData, 1, WhichQuestion)
  436.   set the itemDelimiter = saveDelim
  437.   
  438.   put "110030" & ThisRegion into WhichRanger
  439.   SwitchRanger WhichRanger
  440.   
  441.   repeat with x = 18 to 21
  442.     puppetSprite x, false
  443.   end repeat
  444.   
  445.   put random(9) into WhichAnwer
  446.   
  447.   put item 2 of line WhichAnwer of field "NegativeResponse" into RangerSez
  448.   put the PathName & "AUDIO" & PathSepChar & "REGION" & ThisRegion & ┬
  449.    PathSepChar & RangerSez into RangerSez
  450.   
  451.   sound PlayFile 1, RangerSez
  452.   go to "GetActivity"
  453.   
  454. end
  455.  
  456. ----------------------
  457.  
  458. on LoadExcludePointerList
  459.   put
  460.   put "entered LoadExcludePointerList"
  461.   
  462.   put the PathName & "LISTS:XCLDPNTR.TXT" into WhichFile
  463.   put FileIO(mNew, "Read", WhichFile) into FileObj
  464.   if ObjectP(FileObj) then
  465.     put FileObj(mReadFile) into TextString
  466.     put TextString into field "ExcludePointerList"
  467.     FileObj(mDispose)
  468.   else
  469.     alert "LoadExcludePointerList failed to return XCLDPNTR.TXT"
  470.   end if
  471.   
  472. end
  473.  
  474. ---------------------
  475.  
  476. on LoadExcludeList
  477.   put
  478.   put "entered LoadExcludeList"
  479.   
  480.   global PathSepChar, ThisRegion
  481.   
  482.   put EMPTY into field "ExcludeList"
  483.   put the Pathname & "LISTS" & PathSepChar & "XCLUD01.TXT" into WhichFile
  484.   put FileIO(mNew, "Read", WhichFile) into FileObj
  485.   
  486.   if ObjectP(FileObj) then
  487.     put value(item 1 of line ThisRegion of field "ExcludePointerList") into CharNum
  488.     FileObj(mSetPosition, CharNum)
  489.     put FileObj(mReadLine) into TextString
  490.     put FileObj(mReadToken, "@", "@") into TextString
  491.     put TextString  after field "ExcludeList"
  492.     FileObj(mDispose)    
  493.   else
  494.     alert "LoadExcludeList failed to return XCLUD01.TXT"
  495.   end if 
  496.   
  497. end
  498.  
  499. ---------------------
  500.